package com.chinda.modules.sys.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.chinda.common.page.RPage;
import com.chinda.modules.sys.qo.SysRoleQO;
import com.chinda.modules.sys.dao.SysRoleDao;
import com.chinda.modules.sys.entity.SysRoleEntity;
import com.chinda.modules.sys.service.SysRoleService;

import java.util.List;

/**
 * 系统角色
 *
 * @author chinda
 * @date 2021-06-16 05:52:51
 */
@Service("sysRoleService")
@Transactional(readOnly = true, rollbackFor = Exception.class)
public class SysRoleServiceImpl extends ServiceImpl<SysRoleDao, SysRoleEntity> implements SysRoleService {

    /**
     * 获取分页信息
     *
     * @param qo
     * @return
     */
    @Override
    public RPage page(SysRoleQO qo) {
        return new RPage(page(qo.getPage(), qo.getQueryWrapper()));
    }

    /**
     * 根据用户id获取角色
     * @param userId
     * @return
     */
    @Override
    public List<SysRoleEntity> selectSysRoleByUserId(Long userId) {
        return baseMapper.selectSysRoleByUserId(userId);
    }
}